package com.riversoft.weixin.common.user;

/**
 * Created by 01event on 2018/3/23.
 */
public enum SubscribeScene {


    ADD_SCENE_SEARCH("ADD_SCENE_SEARCH","公众号搜索"),
    ADD_SCENE_ACCOUNT_MIGRATION("ADD_SCENE_ACCOUNT_MIGRATION","公众号迁移"),
    ADD_SCENE_PROFILE_CARD("ADD_SCENE_PROFILE_CARD","名片分享"),
    ADD_SCENE_QR_CODE("ADD_SCENE_QR_CODE","扫描二维码"),
    ADD_SCENEPROFILE_LINK("ADD_SCENEPROFILE_LINK","图文页内名称点击"),
    ADD_SCENE_PROFILE_ITEM("ADD_SCENE_PROFILE_ITEM","图文页右上角菜单"),
    ADD_SCENE_PAID("ADD_SCENE_PAID","支付后关注"),
    ADD_SCENE_OTHERS("ADD_SCENE_OTHERS","其他");

    private String name;
    private String code;

    private SubscribeScene(String code,String name) {
        this.name = name;
        this.code = code;
    }

    public static SubscribeScene fromCode(String code) {
        for (SubscribeScene subscribeScene : SubscribeScene.values()) {
            if (subscribeScene.code.equals (code)) {
                return subscribeScene;
            }
        }
        return SubscribeScene.ADD_SCENE_OTHERS;
    }

    public String getName() {
        return this.name;
    }
    public String getCode() {
        return this.code;
    }
}
